# -*- coding: utf-8 -*-
#
# Copyright 2008 Yejun Yang
#

import webappex
from webappex.mako_template import MakoLookup
import logging
from webappex.utils import secure
from webappex.counter import Counter

from webappex.table import Table, LocalTable, MemcacheTable, DatastoreTable

l = MakoLookup("templates_src","templates")
c = Counter('test10')

class MainHandler(webappex.SimpleHandler):
  #@secure
  def test(self):
    x = DatastoreTable('xxx2', expires=50)
    logging.info( str(x))
    self.response.out.write(l.get_template('test/test.html').render(handler=self, result=x.setdefault('a',1)))

def main():
    application = webappex.Application([('/(.*)', MainHandler)],
                                       debug=True)

    application.run()


if __name__ == '__main__':
  main()
